package com.otaku.order.fallback;

import com.otaku.common.ResultUtils.ResultModel;
import com.otaku.common.ResultUtils.ResultCode;
import com.otaku.common.ResultUtils.ResultUtil;
import com.otaku.memberAPI.entity.UserEntity;
import com.otaku.order.feign.FeignMemberService;
import org.springframework.stereotype.Component;

@Component
public class FallbackMember implements FeignMemberService {

    @Override
    public UserEntity getMember(String name) {
        UserEntity userEntity = new UserEntity();
        userEntity.setName("abc");
        userEntity.setAge(200);
        return userEntity;
    }

    @Override
    public String getMemberInfo() {
        return "服务器开小差，稍后重试哈-getMemberInfo";
    }

    @Override
    public String getMemberInfoHystrix() {
        return "服务器开小差，稍后重试哈-getMemberInfoHystrix";
    }

    @Override
    public ResultModel getSysError() {
        return ResultUtil.error(ResultCode.INSUFFICIENT_AUTHORITY);
    }

    @Override
    public ResultModel getSysError2() {
        return ResultUtil.error(ResultCode.SERVER_ERROR);
    }
}
